package tec;


public class LancerTests{
    public static void main(String... args) throws TecInvalidException, Exception{
    boolean estMisAssertion = false;
    assert estMisAssertion = true;

    if (!estMisAssertion) {
	System.out.println("Execution impossible sans l'option -ea");
	return;
    }
    

    Class TestJaugeNaturel      = Class.forName("tec.TestJaugeNaturel");
    Class TestAutobus           = Class.forName("tec.TestAutobus");
    Class TestEtatPassager      = Class.forName("tec.TestEtatPassager");
    
    TestPassagerStandard  testPassagerStandard = new TestPassagerStandard();
    TestPassagerLunatique testPassagerLunatique= new TestPassagerLunatique();
    TestPassagerStresse   testPassagerStresse  = new TestPassagerStresse();
    
    lancer(TestJaugeNaturel);
    lancer(TestAutobus);
    lancer(TestEtatPassager);
    testPassagerStandard.lancerTestPassagerStandard();
    testPassagerLunatique.lancerTestPassagerLunatique();
    testPassagerStresse.lancerTestPassagerStresse();
  }
    
    static private void lancer(Class c) throws Exception {
	
	int i;
	String s;
	Object arg[]=null;
	int nbTest = 0;
	java.lang.reflect.Method[] m = c.getMethods();
	
	for(i=0;i<m.length;i++){

	    s = m[i].getName();
	    if(s.startsWith("test")){
		m[i].invoke(c.newInstance(),arg);
		System.out.print("."); nbTest++;
	    }
	}
	System.out.println("(" + nbTest + "):OK: " + c.getName()); 
    }



}
